local items = {
	settingsfile = "HolyP.json",
	callback = GUICallback,
	{ type = "title", text = "奶骑 |c0000CED1PvE" },
	{ type = "separator" },	
	{ type = "page", number = 1, text = "|cffFFFF00保命功能|r" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(1038))..":26:26\124t  拯救之手", tooltip = "拯救之手", enabled = true, key = "HandofSalvation" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(642))..":26:26\124t  圣盾术 HP% <", tooltip = "圣盾术 < HP%", enabled = true, value = 50, key = "DivineShield" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(48788))..":26:26\124t  圣疗术 HP% <", tooltip = "圣疗术 < HP%", enabled = true, value = 50, key = "LayonHands" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(10278))..":26:26\124t  保护之手 HP% <", tooltip = "保护之手 < HP%", enabled = true, value = 50, key = "HandofProtection" },
	{ type = "entry", text = "\124T"..GetItemIcon(36894)..":26:26\124t 使用 治疗石 HP% <", tooltip = "治疗石", enabled = true, value = 60, key = "FelHealthstone" },
	{ type = "page", number = 2, text = "|cFF00FF00加血功能|r" },
	{ type = "separator" },
	--{ type = "entry", text = "\124T"..select(3, GetSpellInfo(20261))..":26:26\124t 智能断条省蓝", tooltip = "智能断条省蓝", enabled = false, key = "StopCasting" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(48782))..":26:26\124t  智能目标无脑加血", tooltip = "无脑加血", enabled = true, key = "TargetHealing" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(48782))..":26:26\124t  自动加血 HP% <", tooltip = "血量< HP%", enabled = true, value = 10, key = "Healing" },
	{ type = "page", number = 3, text = "|cFF00FF00防护功能|r" },
	{ type = "separator" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(53563))..":26:26\124t  自动道标", tooltip = "圣光道标", enabled = true, key = "BeaconofLight" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(53601))..":26:26\124t  自动护盾", tooltip = "圣洁护盾", enabled = true, key = "SacredShield" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(64205))..":26:26\124t  神圣牺牲", tooltip = "CD好了就用神圣牺牲", enabled = false, key = "DivineSacrifice" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(31821))..":26:26\124t  光环掌握", tooltip = "CD好了就用光环掌握", enabled = false, key = "AuraMastery" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(1044))..":26:26\124t  焦点自由", tooltip = "对焦点目标使用自由之手", enabled = false, key = "focusAuraMastery" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(48788))..":26:26\124t  焦点圣疗 焦点血量% <", tooltip = "对焦点目标使用圣疗术", enabled = true, value = 35, key = "focusLayonHands" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(10278))..":26:26\124t  焦点保护 焦点血量% <", tooltip = "对焦点目标使用保护之手", enabled = true, value = 35, key = "focusHandofProtection" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(6940))..":26:26\124t  焦点牺牲 焦点血量% <", tooltip = "对焦点目标使用牺牲之手", enabled = true, value = 35, key = "focusHandofSacrifice" },
	{ type = "page", number = 4, text = "|cFF00FF00辅助功能|r" },
	{ type = "separator" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(10308))..":26:26\124t  打断", tooltip = "制裁之锤", enabled = false, key = "HammerofJustice" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(4987))..":26:26\124t   驱散", tooltip = "清洁术", enabled = false, key = "Cleans" },	
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(19746))..":26:26\124t  自动光环", tooltip = "自动光环", enabled = true, key = "AutoAura" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(20216))..":26:26\124t  神恩术", tooltip = "自动神恩术", enabled = true, key = "DivineFavor" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(31842))..":26:26\124t  神启", tooltip = "自动神启", enabled = true, key = "DivineIllumination" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(20060))..":26:26\124t  自动目标", tooltip = "自动目标", enabled = true, key = "AutoTarget" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(54155))..":26:26\124t  纯洁审判 秒 <", tooltip = "纯洁审判加速效果", enabled = true, value = 30, key = "JudgementsofthePure" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(28730))..":26:26\124t  奥术洪流 MP% <", tooltip = "奥术洪流（血精灵专用）", enabled = true, value = 95, key = "ArcaneTorrent" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(54428))..":26:26\124t  神圣恳求 MP% <", tooltip = "神圣恳求", enabled = true, value = 75, key = "DivinePlea" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(20166))..":26:26\124t  自动圣印", tooltip = "自动圣印", enabled = true, key = "Seal" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(48819))..":26:26\124t  智能奉献 怪物数量 >", tooltip = "数量大于且奉献CD好了就用", enabled = true, value = 3, key = "Consecration" },
	{ type = "entry", text = "\124T"..select(3, GetSpellInfo(51306))..":26:26\124t  调试", tooltip = "显示调试信息", enabled = false, key = "debug" },
	
};
 
local function GetSetting(name)
    for k, v in ipairs(items) do
        if v.type == "entry"
         and v.key ~= nil
         and v.key == name then
            return v.value, v.enabled
        end
    end
end;

local function OnLoad()
	ni.GUI.AddFrame("HolyP", items);
end;

local function OnUnLoad()  
	ni.GUI.DestroyFrame("HolyP");
end;

local spells = {
	DivineShield = {id = 642, name = GetSpellInfo(642)},  --圣盾术
	DivineProtection = {id = 498, name = GetSpellInfo(498)},  --圣佑术
	LayonHands = {id = 48788, name = GetSpellInfo(48788)},  --圣疗术
	Cleanse = {id = 4987, name = GetSpellInfo(4987)},  --清洁术
	Exorcism = {id = 48801, name = GetSpellInfo(48801)},  --驱邪术
	DivineFavor = {id = 20216, name = GetSpellInfo(20216)},  --神恩术
	HandofProtection = {id = 10278, name = GetSpellInfo(10278)},  --保护之手
	HandofSalvation = {id = 1038, name = GetSpellInfo(1038)},  --拯救之手
	HandofFreedom = {id = 1044, name = GetSpellInfo(1044)},  --自由之手
	HandofReckoning = {id = 62124, name = GetSpellInfo(62124)},  --清算之手
	HandofSacrifice = {id = 6940, name = GetSpellInfo(6940)},  --牺牲之手
	HammerofJustice = {id = 10308, name = GetSpellInfo(10308)},  --制裁之锤
	HammerofWrath = {id = 48806, name = GetSpellInfo(48806)},  --愤怒之锤
	JudgementofLight = {id = 20271, name = GetSpellInfo(20271)},  --圣光审判
	JudgementofWisdom = {id = 53408, name = GetSpellInfo(53408)},  --智慧审判
	JudgementofJustice = {id = 53407, name = GetSpellInfo(53407)},  --公正审判
	SealofCorruption = {id = 53736, name = GetSpellInfo(53736)},  --腐蚀圣印
	SealofVengeance = {id = 31801, name = GetSpellInfo(31801)},  --复仇圣印
	SealofLight = {id = 20165, name = GetSpellInfo(20165)},  --光明圣印
	SealofWisdom = {id = 20166, name = GetSpellInfo(20166)},  --智慧圣印
	SealofRighteousness = {id = 21084, name = GetSpellInfo(21084)},  --正义圣印
	SealofJustice = {id = 20164, name = GetSpellInfo(20164)},  --公正圣印
	CrusaderAura = {id = 32223, name = GetSpellInfo(32223)},  --十字军光环
	RetributionAura = {id = 54043, name = GetSpellInfo(54043)},  --惩戒光环
	FrostResistanceAura = {id = 48945, name = GetSpellInfo(48945)},  --冰霜抗性光环
	ShadowResistanceAura = {id = 48943, name = GetSpellInfo(48943)},  --暗影抗性光环
	FireResistanceAura = {id = 48947, name = GetSpellInfo(48947)},  --火焰抗性光环
	ConcentrationAura = {id = 19746, name = GetSpellInfo(19746)},  --专注光环
	DevotionAura = {id = 48942, name = GetSpellInfo(48942)},  --虔诚光环 
	AuraMastery = {id = 31821, name = GetSpellInfo(31821)},  --光环掌握
	GreaterBlessingofWisdom = {id = 48938, name = GetSpellInfo(48938)},  --强效智慧祝福	
	GreaterBlessingofKings = {id = 25898, name = GetSpellInfo(25898)},  --强效王者祝福	
	GreaterBlessingofMight = {id = 48934, name = GetSpellInfo(48934)},  --强效力量祝福
	AvengingWrath = {id = 31884, name = GetSpellInfo(31884)},  --复仇之怒
	RighteousFury = {id = 25780, name = GetSpellInfo(25780)},  --正义之怒
	ShieldofRighteousness = {id = 61411, name = GetSpellInfo(61411)},  --正义盾击
	RighteousDefense = {id = 31789, name = GetSpellInfo(31789)},  --正义防御
	DivineSacrifice = {id = 64205, name = GetSpellInfo(64205)},  --神圣牺牲
	DivineIntervention = {id = 19752, name = GetSpellInfo(19752)},  --神圣干涉
	DivinePlea = {id = 54428, name = GetSpellInfo(54428)},  --神圣恳求
	HolyWrath = {id = 48817, name = GetSpellInfo(48817)},  --神圣愤怒
	HolyShock = {id = 48825, name = GetSpellInfo(48825)},  --神圣震击
	DivineIllumination = {id = 31842, name = GetSpellInfo(31842)},  --神启
	Consecration = {id = 48819, name = GetSpellInfo(48819)},  --奉献
	BlessingofWisdom = {id = 48936, name = GetSpellInfo(48936)},  --智慧祝福	
	BlessingofKings = {id = 20217, name = GetSpellInfo(20217)},  --王者祝福	
	BlessingofMight = {id = 48932, name = GetSpellInfo(48932)},  --力量祝福
	HolyLight = {id = 48782, name = GetSpellInfo(48782)},  --圣光术
	BeaconofLight = {id = 53563, name = GetSpellInfo(53563)},  --圣光道标
	FlashofLight = {id = 48785, name = GetSpellInfo(48785)},  --圣光闪现
	SacredShield = {id = 53601, name = GetSpellInfo(53601)},  --圣洁护盾
	ArcaneTorrent = {id = 28730, name = GetSpellInfo(28730)},  --奥术洪流
	FelHealthstone = {id = 36894, name = GetItemInfo(36894)}, --治疗石

};

 
local Cache = {
	enemies = ni.player.enemiesinrange(35),
    zjzz = zjzz or UnitRace("player") 
}

local queue = {
	"Cache",
	"Pause",
	"Fel Healthstone",
	"DivineShield",
	"HandofSalvation",
    "HammerofJustice",
	"Seal",
	"AutoAura",
	"BeaconofLight",
	"SacredShield",
	"AutoTarget",
	"DivineIllumination",
	"DivinePlea",
	"DivineSacrifice",
	"AuraMastery",
	"ArcaneTorrent",
	"Cleans",
	"Consecration",
	"StopCasting",
	"JudgementsofthePure",
	"TargetHealing",
	"Healing",
	"debug",
	
};

local delaytime = 0

local function UnitCastSpellTime(unit) 
	unit = unit or target
	if not ni.unit.exists(unit) then
		return -1,-1,"";
	end
	local spell, _, _, _, startTime, endTime = UnitCastingInfo(unit)
	print(spell)
	if spell then 
		local finish = endTime/1000 - GetTime()
		return tonumber(format("%.2f",finish) ),tonumber(format("%.2f",(endTime -startTime) /1000)),spell
	end
	local spellch, _, _, _, startTime, endTimech = UnitChannelInfo(unit)
	if spellch then 
		local finishch = endTimech/1000 - GetTime()
		return tonumber(format("%.2f",finishch) ),tonumber(format("%.2f",(endTimech -startTime) /1000)),spellch
	end
	return -1,-1,"";
end

local function StringFind(String,Tbl,Type) 
	if (not String) or (not Tbl) then
		return nil;
	end
	if type(Tbl) == "string" then
	
		Tbl = { strsplit(",",Tbl) }
	elseif type(Tbl) == "table" then
	else
		return nil;
	end
	if type(String) == "string" then	
		String = { strsplit(",",String) }
	elseif type(String) == "table" then
	else
		return nil;
	end
	if Type == nil then
		Type=0
	end
	local n;
	local Tbl_index=1;
	local String_index=1;
	for i,v in ipairs(Tbl) do
		String_index=1;
		for k,va in ipairs(String) do
			n = strfind(va,v,1,true);
			if not n then
				n = strfind(strlower(va),strlower(v),1,true);
			end			
				if n then
					if Type == -1 then
						return n,v,va,Tbl_index,String_index;						
					elseif Type == 0  then
						if va == v then
							return n,v,va,Tbl_index,String_index;
						end					
					elseif Type == n then
						return n,v,va,Tbl_index,String_index;
					end
				end
			String_index=String_index+1;
		end		
		Tbl_index=Tbl_index+1;
	end
	return nil;
end

 local function dmbzl(unit)
		     local unit = unit or "target"
             if ni.unit.buff(unit, spells.BeaconofLight.id, "player") then return nil end  
			 if ni.player.ismoving() and ni.spell.cd(spells.HolyShock.id) <1
		     then ni.spell.cast(spells.HolyShock.name, unit) return true
             else ni.spell.cast(spells.HolyLight.name, unit) return true
             end   
           end

	

local abilities = {
	["Cache"] = function()
			Cache.enemies = ni.player.enemiesinrange(35)
			tgzlmb = ""  if UnitCanAttack("player", "target") then tgzlmb = "targettarget" else  tgzlmb = "target" end
		    mainTank, offTank = ni.tanks()
		    QshengqishiyuduQ = QshengqishiyuduQ or CreateFrame("frame","QshengqishiyuduQ")      
            QshengqishiyuduQ:RegisterEvent("UNIT_SPELLCAST_SENT")     
            QshengqishiyuduQ:SetScript("OnEvent", function(_,_,a,b,_,c)     
            if a=="player" then
                if b=="圣光道标" then 
				dbmb=c
				print("道标已补》》》》》》"..c)
				end
                if b=="圣光术" then
				zlmb=c
				print("正在为》》》"..c.."《《《预读大圣光")
				end      
                if b=="圣洁护盾" then 
				hdmb=c
				print("圣洁护盾》》》》》》"..c)
				end 
                QshengqishiyuduQ:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")  end  end)   
		end,
	["AutoTarget"] = function()    --自动目标
	local _, enabled = GetSetting("AutoTarget")
		if enabled then
		  if UnitAffectingCombat("player") 
		    and not ni.unit.exists("target")  then
			ni.player.runtext("/startattack")
			return true
		  end
		end
	end,

	["AutoAura"] = function()    --自动光环
	local _, enabled = GetSetting("AutoAura")
	  if enabled then
		if IsMounted() or ni.player.debuffs("71941||70873") then
		   if not ni.player.aura(spells.CrusaderAura.id) then ni.spell.cast(spells.CrusaderAura.name) return true end
	    elseif not ni.player.buffs("54043||48945||48943||48947||19746||48942")  then
		   ni.spell.cast(spells.ConcentrationAura.name) return true 
		end
	  end
	end,

	["Pause"] = function()     --停止条件
		if IsMounted()
			or UnitIsDeadOrGhost("player")
			or ni.player.iscasting()
			or ni.player.ischanneling() then
			return true
		end
		if ni.player.buff(642) then
		   if ni.spell.cd(spells.DivineSacrifice.id) <1
			  then ni.spell.cast(spells.DivineSacrifice.name) return true end
		   if ni.spell.cd(spells.HandofSacrifice.id) <1
			  then ni.spell.cast(spells.HandofSacrifice.name,dbmb) return true end
		end  
		if not ni.player.buff(642) and ni.player.buff(64205)  then ni.player.cancelbuff(64205) return true end
	end,

	["DivineShield"] = function()  --圣盾术
	local value, enabled = GetSetting("DivineShield")
		if enabled
		    and UnitAffectingCombat("player")
			and not ni.player.debuff(25771)
			and ni.spell.cd(spells.DivineShield.id) <1
			and ni.player.hp() <= value then
				ni.spell.cast(spells.DivineShield.name)
				return true;
		end 
	end,

	["LayonHands"] = function()  --圣疗术
	local value, enabled = GetSetting("LayonHands")
		if enabled
		    and UnitAffectingCombat("player")
			and not ni.player.debuff(25771)
			and ni.spell.cd(spells.LayonHands.id) <1
			and ni.player.hp() <= value then
				ni.spell.cast(spells.LayonHands.name,"player")
				return true;
		end 
	end,

	["HandofProtection"] = function()  --保护之手
	local value, enabled = GetSetting("HandofProtection")
		if enabled
		    and ni.player.hp() <= value
		    and UnitAffectingCombat("player")
			and not ni.player.debuff(25771)
			and ni.spell.cd(spells.HandofProtection.id) <1
		    then
				ni.spell.cast(spells.HandofProtection.name,"player")
				return true;
		end 
	end,

	["DivineSacrifice"] = function()  --自动神圣牺牲
	local _, enabled = GetSetting("DivineSacrifice")
		if enabled
		    and UnitAffectingCombat("player") 
			and ni.spell.cd(spells.DivineSacrifice.id) <1
			then
				ni.spell.cast(spells.DivineSacrifice.name)
				return true;
		end 
	end,

	["AuraMastery"] = function()  --自动光环掌握
	local _, enabled = GetSetting("AuraMastery")
		if enabled
		    and UnitAffectingCombat("player") 
			and ni.spell.cd(spells.AuraMastery.id) <1
			then
				ni.spell.cast(spells.AuraMastery.name)
				return true;
		end 
	end,

	["DivineFavor"] = function()  --神恩术
	local _, enabled = GetSetting("DivineFavor")
		if enabled
		    and UnitAffectingCombat("player") 
		    and ni.player.power() <= 95
			and ni.spell.cd(spells.DivineFavor.id) <1
			then
				ni.spell.cast(spells.DivineFavor.name)
				return true;
		end 
	end,

	["DivineIllumination"] = function()  --神启
	local _, enabled = GetSetting("DivineIllumination")
		if enabled
		    and UnitAffectingCombat("player") 
			and ni.player.power() <= 95
			and ni.spell.cd(spells.DivineIllumination.id) <1
			then
				ni.spell.cast(spells.DivineIllumination.name)
				return true;
		end 
	end,

	["DivinePlea"] = function()  --神圣恳求
	local value, enabled = GetSetting("DivinePlea")
		if enabled
		    and ni.player.power() <= value
			and ni.spell.cd(spells.DivinePlea.id) <1
		    then
				ni.spell.cast(spells.DivinePlea.name,"player")
				return true;
		end 
	end,

	--[[
	["StopCasting"] = function()  --自动断条省蓝
	local _, enabled = GetSetting("StopCasting")
		if enabled then
		    local sysj,sfsj,jnmz = UnitCastSpellTime("player") 
            local dxcc = zlmb 
		    local Jdxl = ni.unit.hp(dbmb)
            if sysj <0  then zlmb=0 
            elseif StringFind("圣光术,圣光闪现",jnmz) then
			    local dxmz = ni.unit.hp(zlmb)
                if sysj<0.2 and Jdxl>=100  and dxmz >=100 then ni.spell.stopcasting() return true                   
                end
            end
        end
    end,
	]]--

	["HandofSalvation"] = function()  --拯救之手
	local _, enabled = GetSetting("HandofSalvation")
		if enabled
		     and ni.player.threat() >= 2
		     and ni.spell.cd(spells.HandofSalvation.id) <1
			 then
				ni.spell.cast(spells.HandofSalvation.name, "player")
				return true;
		end
	end,

	["Cleans"] = function()	  --清洁术
	local _, enabled = GetSetting("Cleans")
        if enabled then
           for i = 1, #ni.members do
               local ally = ni.members[i].unit;
               if ni.healing.candispel(ally)
               and ni.spell.valid(spells.Cleans.id, ally,false, true, true)
			   then
               ni.spell.cast(spells.Cleans.name, ally)
               end
		   end
        end
    end,

	["Fel Healthstone"] = function()  --治疗石
	local value, enabled = GetSetting("FelHealthstone")
		if enabled
		    and UnitAffectingCombat("player")
			and ni.player.hp() <= value
			and ni.player.itemready(spells.FelHealthstone.id)  then
				ni.player.useitem(spells.FelHealthstone.name)
				return true;
		end
	end,

    ["HammerofJustice"] = function()   --制裁之锤
	local _, enabled = GetSetting("HammerofJustice")
        if enabled
		   and UnitAffectingCombat("player")
		   and (ni.unit.iscasting("target") or ni.unit.ischanneling("target") or UnitName("target")=="瓦格里暗影戒卫者" ) 
		   and ni.spell.cd(spells.HammerofJustice.id)<1
	       and ni.spell.valid(spells.HammerofJustice.id,"target",true, true, false)
		then
            ni.spell.cast(spells.HammerofJustice.name,"target")
        end
    end,

	["Consecration"] = function()  --智能奉献
	local value, enabled = GetSetting("Consecration")
	local enear = #ni.player.enemiesinrange(7) --8码内敌人数量 --
	  if enabled 
		 and enear >= value 
		 and ni.spell.cd(spells.Consecration.id) < 1 then
		     ni.spell.cast(spells.Consecration.name) 
			return true;	
	  end
	end,

	["Seal"] = function()  --自动圣印
	local _, enabled = GetSetting("Seal")
        if enabled and not ni.player.buff(spells.SealofWisdom.id) then
		    ni.spell.cast(spells.SealofWisdom.name) return true
		   
		end
	end,

	["focusHandofFreedom"] = function()  --焦点自由
	local _, enabled = GetSetting("focusHandofFreedom")
        if enabled 
		and ni.spell.cd(spells.HandofFreedom.id)<1
		then
		    ni.spell.cast(spells.HandofFreedom.name,"focus") return true
		   
		end
	end,

	["focusHandofSacrifice"] = function()  --焦点牺牲
	local value, enabled = GetSetting("fucosHandofSacrifice")
        if enabled 
		and ni.unit.hp("focus") <value
		and ni.spell.cd(spells.HandofSacrifice.id)<1
		then
		    ni.spell.cast(spells.HandofSacrifice.name,"focus") return true
		   
		end
	end,

	["focusLayonHands"] = function()  --焦点圣疗
	local value, enabled = GetSetting("focusLayonHands")
        if enabled 
		and ni.unit.hp("focus") <value
		and not ni.unit.buff("focus",25771)
		and ni.spell.cd(spells.LayonHands.id)<1
		then
		    ni.spell.cast(spells.LayonHands.name,"focus") return true
		end
	end,

	["focusHandofProtection"] = function()  --焦点保护
	local value, enabled = GetSetting("focusHandofProtection")
        if enabled 
		and ni.unit.hp("focus") <value
		and not ni.unit.buff("focus",25771)
		and ni.spell.cd(spells.HandofProtection.id)<1
		then
		    ni.spell.cast(spells.HandofProtection.name,"focus") return true
		   
		end
	end,

	["JudgementsofthePure"] = function()  --纯洁审判
	local value, enabled = GetSetting("JudgementsofthePure")
        if enabled 
		and UnitAffectingCombat("player")
		and ni.player.buffremaining(54153)<value 
		and ni.spell.cd(spells.JudgementofLight.name)<1
		then
		    ni.spell.cast(spells.JudgementofLight.name)
		end
	end,

	["BeaconofLight"] = function()  --自动道标
	local _, enabled = GetSetting("BeaconofLight")
	local dbmb =   dbmb or UnitName("focus") or UnitName("player")
	     if enabled  
		 and ni.unit.buffremaining(dbmb,spells.BeaconofLight.id,"player") <3 and
		 ni.spell.cast(spells.BeaconofLight.name,dbmb)
		 then
		 return true 
		 end 
	end, 

	["SacredShield"] = function()  --自动圣洁护盾
	local _, enabled = GetSetting("SacredShield")
	local hdmb = hdmb or UnitName("focus") or UnitName("player")
	    if enabled 
		and ni.unit.buffremaining(hdmb,spells.SacredShield.id,"player") <3 and
		ni.spell.cast(spells.SacredShield.name,hdmb)
		then
		return true 
		 end 
	end, 

	["TargetHealing"] = function()	 --自动目标加血
	local _, enabled = GetSetting("TargetHealing")
        if enabled and UnitExists("target") then  
             dmbzl(tgzlmb)   
        end
    end,

	["Healing"] = function()	 --自动加血
	local value, enabled = GetSetting("Healing")
        if enabled then
           for i = 1, #ni.members do
               local ally = ni.members[i].unit;
               if ni.unit.hp(ally) <= value  and not ni.unit.buff(ally, spells.BeaconofLight.id, "player")  then
			       if ni.player.ismoving() and ni.spell.cd(spells.HolyShock.id) <1 then
			         ni.spell.cast(spells.HolyShock.name, ally) return true
                   else ni.spell.cast(spells.HolyLight.name, ally) return true
		           end
               end 
		   end
		   if ni.unit.hp(dbmb) <= value then ni.spell.cast(spells.HolyLight.name, "player") return true end
		end
    end,

	["debug"] = function()  --调试
	local _, enabled = GetSetting("debug")
		if enabled then
		     ni.vars.debug = true
		else
             ni.vars.debug = false
		end
	end,

	["ArcaneTorrent"] = function()  --奥术洪流
	local value, enabled = GetSetting("ArcaneTorrent")
		if enabled
		    and UnitAffectingCombat("player")
			and ni.player.power() <= value
			and ni.spell.cd(spells.ArcaneTorrent.id) <1 then 
				ni.spell.cast(spells.ArcaneTorrent.name)
				return true;
		end
	end,

};
ni.bootstrap.profile("HolyP", queue, abilities, OnLoad, OnUnLoad);	
